package com.java.generics;

import java.util.Date;

public class DateInterval extends Pair<Date> {
	@Override
	public void setSecond(Date second) {
		if(second.compareTo(this.getFirst())>=0){
			super.setSecond(second);
		}else{
			throw new ExceptionInInitializerError("结束时间不能小于开始时间！");
		}
	}

	@Override
	public Date getSecond() {
		return super.getSecond();
	}
}
